extends Node2D


# Called when the node enters the scene tree for the first time.
func _ready():
	var button:Button =  %Button
	var item_db = load("res://datamodel/item/item_db.tres") as ItemDB
	var item_name = item_db.get_item_info("ITEM_L1_CHICKEN")["name"] + "(点我触发效果)"
	button.text = item_name
	button.icon = load(item_db.get_item_info("ITEM_L1_CHICKEN")["texture2d"]) as Texture2D
	button.set_tooltip_text(item_db.get_item_descp_with_arg("ITEM_L1_CHICKEN"))


	var button2:Button = %Button2
	button2.text = item_db.get_item_info("ITEM_L2_CHICKEN")["name"]
	button2.icon = load(item_db.get_item_info("ITEM_L1_CHICKEN")["texture2d"]) as Texture2D
	button2.set_tooltip_text(item_db.get_item_descp_with_arg("ITEM_L2_CHICKEN"))

	pass # Replace with function body.


func _on_button_pressed():
	var item_db = load("res://datamodel/item/item_db.tres") as ItemDB
	var e = item_db.create_effective_by_item_info("ITEM_L1_CHICKEN") as EffectiveBase
	var p = %Player.player_dm as PlayerDM
	e.character = p
	%Player.add_child(e)
	e.apply()
	pass # Replace with function body.


func _on_button_2_pressed() -> void:
	var item_db = load("res://datamodel/item/item_db.tres") as ItemDB
	var e = item_db.create_effective_by_item_info("ITEM_L2_CHICKEN") as EffectiveBase
	print("e", e)
	var p = %Player.player_dm as PlayerDM
	e.character = p
	%Player.add_child(e)
	e.apply()
	pass # Replace with function body.
